<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>js object</title>
		<script>
			var f = {
				name: "桃树",
				price: 455,
				showSelf: function() {
					alert("名字叫：" + this.name + ",价格是：" + this.price);
				}
			};
			//f.showSelf();
			//f.price = 999;
			//f.showSelf();
			var ar = [{
					name: "桃树",
					price: 455,
					showSelf: function() {
						alert("名字叫：" + this.name + ",价格是：" + this.price);
					}
				},
				{
					name: "梨树",
					price: 455,
					showSelf: function() {
						alert("名字叫：" + this.name + ",价格是：" + this.price);
					}
				},
				{
					name: "菠萝树",
					price: 455,
					showSelf: function() {
						alert("名字叫：" + this.name + ",价格是：" + this.price);
					}
				}
			]; //JSON
			for (var i in ar) {
				alert("i="+i+",");
				ar[i].showSelf();
			}
		</script>
	</head>
	<body>
	</body>
</html>
